const { News } = require('../../../model/news');
const { decodeToken } = require('../../../middleGuard/jwt')

module.exports = async (req, res) => {
    console.log('req.params', req.params)
    const { id } = req.params
    const userId = decodeToken(req.headers.authorization).userId
  const data = await News.findOne({_id: id ,user: userId}).populate('user', '_id, username nickname avatar')
  res.json({
      data: data
  })
}